#!/bin/bash

# @TODO will cause plugin help does not works
#
# help() {
#   echo "Usage:"
#   echo "  zmicro plugin run <plugin_name> <plugin_command> <args...>"
#   echo ""
# }

core() {
  # if [ "$0" = "-h" ] || [ "$0" = "--help" ]; then
  #   help
  #   exit 0
  # fi
  local plugin_name=$1
  local plugin_command=${@:2}

  if [ -z "$plugin_name" ]; then
    log::error "[run] plugin name is required"
    exit 1
  fi

  plugin::run $plugin_name $plugin_command
}

# @TODO donot override core/run
::run() {
  core $@
}

::run $@
